/*
 *	window.c
 *
 *	fftrun.lib
 */

#define _USE_MATH_DEFINES
#include <math.h>

void RectangularWindow(float* Window, const int N)
{
	int i;
	for(i = 0; i < N/4; ++i)
	{
		Window[i+0*N/4] = 0;
		Window[i+1*N/4] = 1.0f;
		Window[i+2*N/4] = 1.0f;
		Window[i+3*N/4] = 0;
	}
}

void HanningWindow(float* Window, const int N)
{
	int i;
	for(i = 0; i < N; ++i)
	{
		Window[i] = (float)(0.5*(1-cos(2*M_PI*i/(N-1))));
	}
}

void HammingWindow(float* Window, const int N)
{
	int i;
	for(i = 0; i < N; ++i)
	{
		Window[i] = (float)(0.54 - 0.46*cos(2*M_PI*i/(N-1)));
	}
}
